#ifndef __DS18B20_H__
#define __DS18B20_H__

#include "stm32f1xx_hal.h"
#include "stm32f1xx_hal_gpio.h"
#include "main.h"
#include "stdint.h"
#include "dwt_us.h"

typedef struct DS18B20_HandleTypeDef
{
    GPIO_TypeDef *port;
    uint16_t pin;
} DS18B20_t;



void DS18B20_Init(DS18B20_t *hds18b20, GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
float DS18B20_ReadTemp(DS18B20_t *hds18b20);

// 非阻塞读取温度函数
uint8_t DS18B20_StartConversion(DS18B20_t *hds18b20);
float DS18B20_ReadTempNonBlocking(DS18B20_t *hds18b20);


#endif /* __DS18B20_H__ */